<?xml version="1.0"?>
<yandex>
    <profiles>
        <log_queries>1</log_queries>
        <!-- 读写用户设置  -->
        <default>
            <max_memory_usage>{{ (ansible_memtotal_mb * 1024 * 1024 * memory_usage_rate) | int }}</max_memory_usage>
            <max_memory_usage_for_all_queries>{{ (ansible_memtotal_mb * 1024 * 1024 * memory_usage_rate) | int }}</max_memory_usage_for_all_queries>
            <max_insert_block_size>4194304</max_insert_block_size>
            <background_pool_size>32</background_pool_size>
            <use_uncompressed_cache>0</use_uncompressed_cache>
            <load_balancing>random</load_balancing>
            <read_backoff_min_events>12</read_backoff_min_events>
            <read_backoff_min_interval_between_events_ms>10000</read_backoff_min_interval_between_events_ms>
            <read_backoff_min_latency_ms>10000</read_backoff_min_latency_ms>
            <http_connection_timeout>1</http_connection_timeout>
            <http_send_timeout>18000</http_send_timeout>
            <http_receive_timeout>18000</http_receive_timeout>
            <send_timeout>18000</send_timeout>
            <receive_timeout>18000</receive_timeout>
            <max_partitions_per_insert_block>300</max_partitions_per_insert_block>
        </default>

        <!-- 只写用户设置  -->
        <readonly>
            <max_memory_usage>{{ (ansible_memtotal_mb * 1024 * 1024 * memory_usage_rate) | int }}</max_memory_usage>
            <use_uncompressed_cache>0</use_uncompressed_cache>
            <load_balancing>random</load_balancing>
            <readonly>1</readonly>
        </readonly>
    </profiles>

    <!-- 配额  -->
    <quotas>
        <!-- Name of quota. -->
        <default>
            <interval>
                <duration>3600</duration>
                <queries>0</queries>
                <errors>0</errors>
                <result_rows>0</result_rows>
                <read_rows>0</read_rows>
                <execution_time>0</execution_time>
            </interval>
        </default>
    </quotas>

    <users>
        <!-- 读写用户  -->
        <default>
            <password_sha256_hex>{{ defaultPasswd }}</password_sha256_hex>
            <networks incl="networks" replace="replace">
                <ip>::/0</ip>
            </networks>
            <profile>default</profile>
            <quota>default</quota>
        </default>

        <!-- 只读用户  -->
        <readonly>
            <password_sha256_hex>30844292d9ed119066da5d1c7cc851edba9cc985ed291a18a8ee3c4b26742fc0</password_sha256_hex>
            <networks incl="networks" replace="replace">
                <ip>::/0</ip>
            </networks>
            <profile>readonly</profile>
            <quota>default</quota>
        </readonly>
    </users>
</yandex>

